<script setup lang="ts">
import type {
  SysUserUpdateLoginQo,
} from '#/system/user'

const formState = $ref<SysUserUpdateLoginQo>(useUserStoreHook().user ?? {})

async function updateInfo() {
  await useUserStoreHook().updateLoginUserInfo(formState)
  Message({
    type: 'success',
    message: '修改成功',
  })
}
</script>

<template>
  <el-form
    :model="formState"
    label-width="auto"
    label-position="left"
  >
    <el-form-item prop="name" label="用户名称">
      <el-input v-model="formState.name" placeholder="请输入用户名称" />
    </el-form-item>
    <el-form-item label="生日" prop="birthday">
      <el-date-picker
        v-model="formState.birthday"
        placeholder="请选择生日"
        style="width: 100%;"
      />
    </el-form-item>
    <el-form-item prop="sex" label="性别">
      <sy-dict
        v-model="formState.sex"
        dict-type="user_sex"
        type="radio"
      />
    </el-form-item>
    <div un-flex="~ justify-end">
      <el-button type="primary" @click="updateInfo">
        提交
      </el-button>
    </div>
  </el-form>
</template>

<style scoped></style>
